<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:SitRep="urn:oasis:names:tc:emergency:EDXL:SitRep:1.0" xmlns:Person="urn:oasis:names:tc:emergency:edxl:ct:1.0" xmlns:PersonName="urn:oasis:names:tc:emergency:edxl:ciq:1.0:xnl">
	<xsl:template match="/">
		<div id="$incidentID_$sitRepType_details" class="collapsableDetail">
			<xsl:for-each select="SitRep:SitRep/SitRep:Report/SitRep:SummaryCount">
				<div class="CIScell">
					<li>
					<b>
						<xsl:call-template name="substring-after-last">
							<xsl:with-param name="string" select="SitRep:CasualtyAndIllnessCountCategory/SitRep:CountCategory/Person:ValueListURI"/>
							<xsl:with-param name="delimiter" select="'/'"/>
						</xsl:call-template>
						</b>: <xsl:value-of select="SitRep:CasualtyAndIllnessCountCategory/SitRep:CountCategory/Person:Value"/>
						<ul>
							<!--Responders-->
							<!--Make sure this node exists and is not empty-->
							<xsl:if test="(SitRep:ResponderSummaryCount) and (SitRep:ResponderSummaryCount[(node())]) and (SitRep:ResponderSummaryCount[(text())])">
								<li>Responder Count: <xsl:value-of select="SitRep:ResponderSummaryCount"/>
								</li>
							</xsl:if>
							<!--Make sure this node exists and is not empty-->
							<!--
								<xsl:if test="(SitRep:ResponderSummaryCountToDate) and (SitRep:ResponderSummaryCountToDate[(node())]) and (SitRep:ResponderSummaryCountToDate[(text())])">
									<li>Responder Count To Date: <xsl:value-of select="SitRep:ResponderSummaryCountToDate"/>
									</li>
								</xsl:if>
							-->
							<!--Non-responders-->
							<!--Make sure this node exists and is not empty-->
							<xsl:if test="(SitRep:NonResponderSummaryCount) and (SitRep:NonResponderSummaryCount[(node())]) and (SitRep:NonResponderSummaryCount[(text())])">
								<li>Non-Responder Count: <xsl:value-of select="SitRep:NonResponderSummaryCount"/>
								</li>
							</xsl:if>
							<!--Make sure this node exists and is not empty-->
							<!--
								<xsl:if test="(SitRep:NonResponderSummaryCountToDate) and (SitRep:NonResponderSummaryCountToDate[(node())]) and (SitRep:NonResponderSummaryCountToDate[(text())])">
									<li>Non-Responder Count To Date: <xsl:value-of select="SitRep:NonResponderSummaryCountToDate"/>
									</li>
								</xsl:if>
							-->
							<!--Immunizations-->
							<!--Make sure this node exists and is not empty-->
							<xsl:if test="(SitRep:ReceivedMassImmunizations) and (SitRep:ReceivedMassImmunizations[(node())]) and (SitRep:ReceivedMassImmunizations[(text())])">
								<li>Received Mass Immunizations: <xsl:value-of select="SitRep:ReceivedMassImmunizations"/>
								</li>
							</xsl:if>
							<!--Make sure this node exists and is not empty-->
							<xsl:if test="(SitRep:RequireMassImmunizations) and (SitRep:RequireMassImmunizations[(node())]) and (SitRep:RequireMassImmunizations[(text())])">
								<li>Require Mass Immunizations: <xsl:value-of select="SitRep:RequireMassImmunizations"/>
								</li>
							</xsl:if>
						</ul>
					</li>
				</div>
			</xsl:for-each>
		</div>
	</xsl:template>
	<xsl:template name="substring-after-last">
		<xsl:param name="string"/>
		<xsl:param name="delimiter"/>
		<xsl:choose>
			<xsl:when test="contains($string, $delimiter)">
				<xsl:call-template name="substring-after-last">
					<xsl:with-param name="string" select="substring-after($string, $delimiter)"/>
					<xsl:with-param name="delimiter" select="$delimiter"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$string"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
